home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-06-19 | 1.3 KB | 50 lines |
- package symantec.itools.awt;
-
-
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Panel;
-
- /**
- * This helper class draws InfoTips
- * @version
- * @author Symantec
- */
- public class InfoTipManager
- {
- private static Panel infoTipPanel;
-
- /**
- * Creates a new Panel for the InfoTip as needed and then returns it.
- * @return a Panel for the InfoTip
- */
- public static Panel getInfoTipPanel()
- {
- if(infoTipPanel == null)
- {
- infoTipPanel = new Panel();
- infoTipPanel.hide();
- infoTipPanel.setLayout(null);
- }
-
- return infoTipPanel;
- }
-
- /**
- * Draws the InfoTip.
- * @param x location of the InfoTip, x coordinate
- * @param y location of the InfoTip, y coordinate
- * @param s text to display in the InfoTip
- * @param fm font used for InfoTip text
- * @param bc background color used for the InfoTip
- * @param fc foreground color used for the InfoTip
- */
- public static void draw(int x, int y, String s, FontMetrics fm, Color bc, Color fc)
- {
- infoTipPanel.reshape(x, y, fm.stringWidth(s), fm.getHeight());
- infoTipPanel.setBackground(bc);
- infoTipPanel.setForeground(fc);
- infoTipPanel.show();
- }
- }